package ${package}.${moduleName}.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qj.bean.ResultMsg;
import com.qj.utils.ResultUtils;
import ${package}.${moduleName}.service.${ClassName}Service;
import ${package}.${moduleName}.query.${ClassName}Query;
import ${package}.${moduleName}.vo.${ClassName}VO;
import ${package}.${moduleName}.form.${ClassName}Form;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
* ${tableComment}
*
* @author ${author} ${email}
* @since ${version} ${date}
*/
@RestController
@RequestMapping("${moduleName}/${functionName}")
@Api(tags="${tableComment}")
public class ${ClassName}Controller {

    @Resource
    private ${ClassName}Service ${className}Service;

    @GetMapping("page")
    @ApiOperation(value = "分页")
    public ResultMsg<IPage<${ClassName}VO>> page(${ClassName}Query query){
        return ResultUtils.success(${className}Service.page(query));
    }

    @GetMapping("{id}")
    @ApiOperation(value = "详情")
    public ResultMsg<${ClassName}VO> get(@PathVariable("id") Long id){
        return ResultUtils.success(${className}Service.getDetail(id));
    }

    @PostMapping
    @ApiOperation(value = "新增")
    public ResultMsg<String> save(@RequestBody ${ClassName}Form form){
        ${className}Service.save(form);
        return ResultUtils.success("新增成功");
    }

    @PutMapping
    @ApiOperation(value = "修改")
    public ResultMsg<String> update(@RequestBody @Valid ${ClassName}Form form){
        ${className}Service.update(form);
        return ResultUtils.success("修改成功");
    }

    @DeleteMapping
    @ApiOperation(value = "删除")
    public ResultMsg<String> delete(@RequestBody List<Long> idList){
        ${className}Service.delete(idList);
        return ResultUtils.success("删除成功");
    }
}